const { ObjectId } = require('mongodb')
const actionDb = require('../manageDb/index')
const { STATUS_CODE } = require('../config/constant')

// 查询图片列表
function queryImageList(req, res) {
	const tableName = 'T_IMAGE'
	const filter = req.body || {};
	if (filter._id) filter._id = new ObjectId(filter._id)

	actionDb(tableName, filter, 'queryMany').then((result) => {
		res.send({
			status: STATUS_CODE.success,
			message: '操作成功',
			data: result
		})
	}).catch(err => {
		console.log(err)
		res.send({
			status: STATUS_CODE.fail,
			message: err
		})
	})
}
module.exports = {
	queryImageList
}